<?php
session_start();
include "session.php";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="html/text; charset=utf-8" />
<title>父模块编辑</title>
</head>
<body>
<?php
  include "mysql.php";
  $aa=new mysql;
  $aa->link("");
  $tijiao=$_POST["tijiao"];
  if($tijiao=="提交"){
         $user_pw=$_POST["user_pw"];
         $query="select * from manager_info where user_pw='$user_pw'";
         $rst=$aa->excu($query);
          if(mysql_num_rows($rst)==0){
              echo "<script language=javascript>alert('密码不正确,请重新填写');</script>";
          }else{
               $user_pw1=$_POST["user_pw1"];
               $user_pw2=$_POST["user_pw2"];
               if( $user_pw1!=$user_pw2){
                  echo "<script language=javascript>alert('您两次输入的密码不正确,请重新填写');</script>";
               }else{
                   $query="update manager_info set user_pw='$user_pw1'";
                   if($aa->excu($query)){
                   echo "<script language=javascript>alert('恭喜您，密码修改成功');</script>";

                   }
               }
          }
  }
  ?>
    <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>
    <table width="30%" border="0" align="center" cellspacing="0"  cellpadding="0" >
        <tr>
            <td height="20" align="center" ><b>欢迎您修改密码</b> </td>
        </tr>
    </table>

 <form action="#" method="post">
<table width="30%" border="1" align="center" cellspacing="0"  cellpadding="0" >
<tr>
    <td height="15" align="right" width="30%">用户名</td>
    <td height="15" align="left" width="70%"><?php echo $_SESSION["user_name"]; ?></td>
</tr>
<tr>
 <td height="15" align="right" width="30%">原口令:</td>
 <td height="15" align="left" width="70%"><input type="password" name="user_pw" ></td>
</tr>
<tr>
 <td height="15" align="right" width="30%">新密码</td>
 <td height="15" align="left" width="70%"><input type="password" name="user_pw1"></td>
</tr>
<tr>
 <td height="15" align="right" width="30%">新密码</td>
 <td height="15" align="left" width="70%"><input type="password" name="user_pw2"></td>
</tr>
<tr>
    <td height="15" align="center" colspan="2">
        <input type="submit" name="tijiao" value="提交">&nbsp;&nbsp;
        <input type="submit" name="tijiao" value="重置">
   </td>
</tr>
</table>
 </form>
</body>
</html>
